Skip to content

feat(new): add --no-hooks flag to skip post-create hooks#91

Merged
helizaga merged 7 commits intocoderabbitai:mainfrom
lucasrcezimbra:new-skip-hooks
Feb 2, 2026
Merged

feat(new): add --no-hooks flag to skip post-create hooks#91
helizaga merged 7 commits intocoderabbitai:mainfrom
lucasrcezimbra:new-skip-hooks

Conversation

@lucasrcezimbra
Copy link
Contributor

@lucasrcezimbra lucasrcezimbra commented Jan 28, 2026

Description

Add a --no-verify flag to git gtr new command that skips execution of post-create hooks.

I chose --no-verify over --no-hooks for consistency with git's convention (git commit --no-verify, git push --no-verify). However, I'm open to changing this to --no-hooks if preferred.

Motivation

Fixes #90

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring (no functional changes)
  • Other (please describe):

Testing

Manual Testing Checklist

Tested on:

  • macOS
  • Linux (specify distro: Debian)
  • Windows (Git Bash)

Core functionality tested:

Test report: https://github.com/lucasrcezimbra/git-worktree-runner/blob/be59e39ffdac88549b66014d7a59a3ebbbb1de59/test-report.md

  • git gtr new <branch> - Create worktree
  • git gtr go <branch> - Navigate to worktree
  • git gtr editor <branch> - Open in editor (if applicable)
  • git gtr ai <branch> - Start AI tool (if applicable)
  • git gtr rm <branch> - Remove worktree
  • git gtr list - List worktrees
  • git gtr config - Configuration commands (if applicable)
  • Other commands affected by this change: git gtr new --no-verify

Test Steps

  1. Configure a post-create hook:
    git config --add gtr.hook.postCreate "echo 'Created!' > /tmp/gtr-test"
  2. Create worktree without the flag:
    ./bin/gtr new test-with-hooks
    cat /tmp/gtr-test  # Should show "Created!"
    rm /tmp/gtr-test
  3. Create worktree with --no-verify:
    ./bin/gtr new test-no-verify --no-verify
    ls /tmp/gtr-test  # Should fail - file should NOT exist
  4. Cleanup:
    ./bin/gtr rm test-with-hooks
    ./bin/gtr rm test-no-verify
    git config --unset gtr.hook.postCreate

Expected behavior: When --no-verify is passed, post-create hooks should be skipped.

Actual behavior: Works as expected. Hooks run normally without the flag, and are skipped with --no-verify.

Breaking Changes

  • This PR introduces breaking changes
  • I have discussed this in an issue first
  • Migration guide is included in documentation

Checklist

Before submitting this PR, please check:

  • I have read CONTRIBUTING.md
  • My code follows the project's style guidelines
  • I have performed manual testing on at least one platform
  • I have updated documentation (README.md, CLAUDE.md, etc.) if needed
  • My changes work on multiple platforms (or I've noted platform-specific behavior)
  • I have added/updated shell completions (if adding new commands or flags)
  • I have tested with both git gtr (production) and ./bin/gtr (development)
  • No new external dependencies are introduced (Bash + git only)
  • All existing functionality still works

License Acknowledgment

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache License 2.0.

Summary by CodeRabbit

  • New Features

    • Added --no-hooks flag to the git gtr new command to skip post-create hooks during worktree creation.
  • Documentation

    • Updated CLI docs and help text; added shell completion support for Bash, Fish, and Zsh.
  • Tests

    • Added a test scenario demonstrating the --no-hooks behavior and cleanup.

Add --no-verify flag completion for Bash, Zsh, and Fish shells to support
skipping post-create hooks when creating new worktrees.
- Add --no-verify flag to README.md Options section
- Add --no-verify to automation flags table in docs/advanced-usage.md
- Add --no-verify test case to CLAUDE.md manual testing workflow
- Complete Phase 3 of --no-verify implementation plan
- Executed all 7 test cases from Phase 4 of the plan
- All tests passed successfully
- Verified default behavior, flag functionality, flag combinations
- Confirmed shell completions and help text updates
- Validated scope isolation (only affects postCreate hooks)
- Test environment cleaned up after execution

All tests PASS - feature is production-ready
The --no-verify flag implementation has been completed and fully tested.
All plan items were successfully implemented across code, completions,
and documentation. Test report confirms all 7 test cases passed.
@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a new CLI flag --no-hooks to git gtr new that prevents running post-create hooks; updates flag parsing, help text, shell completions, and documentation, and includes a test scenario demonstrating the no-hooks path and cleanup.

Changes

Cohort / File(s) Summary
Core implementation
bin/gtr
Adds --no-hooks option, introduces skip_hooks flag variable, conditions post-create hook execution on skip_hooks, and updates command help text.
Documentation & tests
README.md, docs/advanced-usage.md, CLAUDE.md
Documents the new --no-hooks flag in CLI docs and advanced usage; adds a test scenario demonstrating creating a worktree with --no-hooks, asserting hook side-effects are absent, cleanup steps.
Shell completions
completions/_git-gtr, completions/git-gtr.fish, completions/gtr.bash
Adds --no-hooks to Zsh, Fish, and Bash completion definitions with description "Skip post-create hooks".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I hopped in quick, no hooks to tend,
A quiet worktree, tidy end.
Skip the bustle, skip the knocks,
I nibble carrots, avoid the shocks.
New flag, small change — a joyful hop! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a --no-verify flag to skip post-create hooks in the git gtr new command.
Linked Issues check ✅ Passed The PR fully implements issue #90 requirements: adds --no-verify flag to skip post-create hooks, maintains backward compatibility, includes shell completions, and provides documentation updates.
Out of Scope Changes check ✅ Passed All changes are scoped to implementing the --no-verify flag feature: CLI flag addition, completions updates, and documentation. No unrelated modifications are present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI review requested due to automatic review settings February 2, 2026 04:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@helizaga helizaga changed the title feat(new): add --no-verify flag to skip post-create hooks feat(new): add --no-hooks flag to skip post-create hooks Feb 2, 2026
@helizaga helizaga merged commit dd0ac97 into coderabbitai:main Feb 2, 2026
1 check was pending
@helizaga
Copy link
Collaborator

helizaga commented Feb 2, 2026

lgtm! thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Add flag to skip hooks in git gtr new

2 participants